package com.haierp.web.context;

import javax.servlet.ServletContextEvent;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;

import com.haierp.service.IWxSessionService;
import com.haierp.service.impl.ReactVersionServiceImpl;

public class HaiContextLoaderListener extends ContextLoaderListener {

	
	@Override
	public void contextInitialized(ServletContextEvent event) {
		super.contextInitialized(event);    
	    ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());    
		//重启后初始化内存缓存
	    IWxSessionService wxSessionService = (IWxSessionService) applicationContext.getBean("wxSessionService"); 
	    wxSessionService.refreshCookieCache();
	    
	    ReactVersionServiceImpl reactVersionService = (ReactVersionServiceImpl) applicationContext.getBean("reactVersionService");
	    reactVersionService.refreshVersion();
	}
}
